import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output, TemplateRef, ViewChild } from '@angular/core';

@Component({
  selector: 'app-wy-carousel',
  templateUrl: './wy-carousel.component.html',
  styleUrls: ['./wy-carousel.component.less'],
  // 改变变更组件策略
  // OnPush策略只会在Input输入属性发生变化时，才会改变组件变更
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class WyCarouselComponent implements OnInit {
  @Input() activeIndex = 0;
  @Output() changeSlide = new EventEmitter<'pre' | 'next'>()
  @ViewChild('dot', { static: true }) dotRef: TemplateRef<any>;

  onChangeSlide(type: 'pre' | 'next') {
    this.changeSlide.emit(type);
  }

  constructor() { }

  ngOnInit() {
  }

}
